package edu.gdpu.bytecode;

/**
 * @author mazebin
 * @date 2021年 07月09日 17:01:32
 * 异常处理的finally带有return语句
 */
public class ByteCodeTest8 {
    public static void main(String[] args) {
        int result = test();
        System.out.println(result);
    }
    public static int test(){
        try {
//int i=10/0;
            return 10;
        }catch ( Exception e){
//            System.out.println("我执行了");
            return 20;
        }finally {
            return  30;
        }
    }
    /**
     * finally带有return的字节码
      Code:
     stack=1, locals=3, args_size=0
     0: bipush        10
     2: istore_0
     3: bipush        30
     5: ireturn
     6: astore_0
     7: bipush        20
     9: istore_1
     10: bipush        30
     12: ireturn
     13: astore_2
     14: bipush        30
     16: ireturn
     Exception table:
     from    to  target type
     0     3     6   Class java/lang/Exception
     0     3    13   any
     6    10    13   any
     LineNumberTable:
     line 16: 0
     line 21: 3
     line 17: 6
     line 19: 7
     line 21: 10
     LocalVariableTable:
     Start  Length  Slot  Name   Signature
     7       6     0     e   Ljava/lang/Exception;

     */
}
